package com.example.servlet;

import com.example.dao.NovelDao;
import com.example.domain.Novel;
import com.example.domain.Review;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;
@WebServlet("/AdminReviewServlet")
public class AdminReviewServlet extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
        request.setCharacterEncoding("utf-8");
        NovelDao novelDao=new NovelDao();
        HttpSession session=request.getSession();
        List<Review> reviewList=novelDao.getReviewCount();
        if (reviewList==null){
            request.setAttribute("msg","没有获取到小说！");
        }
        session.setAttribute("reviewList",reviewList);
        session.setAttribute("reviewPage",1);
        request.getRequestDispatcher("admin_review.jsp").forward(request,response);
    }
}
